﻿namespace WMS6.Web.Analytics
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class InOutBlanaceRptQuery : BasePage
    {
        protected Button btnSearch;
        protected CheckBox ckbShowLot;
        protected DropDownList ddlExpiryDateOper;
        protected DropDownList ddlExternalLotOper;
        protected DropDownList ddlLotAttribute01;
        protected DropDownList ddlLotAttribute02;
        protected DropDownList ddlLotAttribute03;
        protected DropDownList ddlLotAttribute04;
        protected DropDownList ddlLotAttribute05;
        protected DropDownList ddlLotAttribute06;
        protected DropDownList ddlLotAttribute07;
        protected DropDownList ddlLotAttribute08;
        protected DropDownList ddlLotAttribute09;
        protected DropDownList ddlLotAttribute10;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlProduceDateOper;
        protected DropDownList ddlSkuClassID;
        protected DropDownList ddlSkuID;
        protected DropDownList ddlVendorID;
        protected HtmlForm F15330;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlHead Head1;
        protected HtmlImage img1;
        protected HtmlImage img3;
        protected HtmlImage img4;
        protected HtmlImage img5;
        protected Label lblEndTime;
        protected Label lblExpiryDate;
        protected Label lblExternalLot;
        protected Label lblLotAttribute02;
        protected Label lblLotAttribute03;
        protected Label lblLotAttribute04;
        protected Label lblLotAttribute05;
        protected Label lblLotAttribute06;
        protected Label lblLotAttribute07;
        protected Label lblLotAttribute08;
        protected Label lblLotAttribute09;
        protected Label lblLotAttribute1;
        protected Label lblLotAttribute10;
        protected Label lblOwnerID;
        protected Label lblProduceDate;
        protected Label lblSkuClassID;
        protected Label lblSkuID;
        protected Label lblStartTime;
        protected Label lblVendorID;
        protected HtmlLink mycss;
        protected Label one1;
        protected Label one2;
        protected TextBox txOwnerID;
        protected TextBox txtEndTime;
        protected TextBox txtExpiryDate;
        protected TextBox txtExpiryDate2;
        protected TextBox txtExternalLot;
        protected TextBox txtLotAttribute01;
        protected TextBox txtLotAttribute02;
        protected TextBox txtLotAttribute03;
        protected TextBox txtLotAttribute04;
        protected TextBox txtLotAttribute05;
        protected TextBox txtLotAttribute06;
        protected TextBox txtLotAttribute07;
        protected TextBox txtLotAttribute08;
        protected TextBox txtLotAttribute09;
        protected TextBox txtLotAttribute10;
        protected TextBox txtProduceDate;
        protected TextBox txtProduceDate2;
        protected TextBox txtSkuClassID;
        protected TextBox txtSkuID;
        protected TextBox txtStartTime;
        protected TextBox txtVendorID;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("InOutBlanaceRptList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDDl()
        {
            this.txtStartTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
            this.txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
            base.SetDefaultOwner(this.txOwnerID);
            base.InitQueryDDL(this.ddlSkuClassID, 0);
            base.InitQueryDDL(this.ddlVendorID, 0);
            base.InitQueryDDL(this.ddlProduceDateOper, 1);
            base.InitQueryDDL(this.ddlExternalLotOper, 0);
            base.InitQueryDDL(this.ddlExpiryDateOper, 1);
            base.InitQueryDDL(this.ddlLotAttribute01, 0);
            base.InitQueryDDL(this.ddlLotAttribute02, 0);
            base.InitQueryDDL(this.ddlLotAttribute03, 0);
            base.InitQueryDDL(this.ddlLotAttribute04, 0);
            base.InitQueryDDL(this.ddlLotAttribute05, 0);
            base.InitQueryDDL(this.ddlLotAttribute06, 0);
            base.InitQueryDDL(this.ddlLotAttribute07, 0);
            base.InitQueryDDL(this.ddlLotAttribute08, 0);
            base.InitQueryDDL(this.ddlLotAttribute09, 0);
            base.InitQueryDDL(this.ddlLotAttribute10, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDDl();
            }
        }

        public string EndTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtEndTime.Text.Trim()).ToString("yyyy-MM-dd") + " 23:59:59");
                }
                return "9999-12-31 23:59:59";
            }
        }

        public string ExpiryDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExpiryDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExpiryDate.Text, this.ddlExpiryDateOper.SelectedValue, this.txtExpiryDate2.Text.Trim(), "ExpiryDate");
                }
                return "";
            }
        }

        public string ExternalLot
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternalLot.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternalLot.Text, this.ddlExternalLotOper.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute01
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute01.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute01.Text.Trim(), this.ddlLotAttribute01.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute02
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute02.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute02.Text.Trim(), this.ddlLotAttribute02.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute03
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute03.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute03.Text.Trim(), this.ddlLotAttribute03.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute04
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute04.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute04.Text.Trim(), this.ddlLotAttribute04.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute05
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute05.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute05.Text.Trim(), this.ddlLotAttribute05.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute06
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute06.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute06.Text.Trim(), this.ddlLotAttribute06.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute07
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute07.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute07.Text.Trim(), this.ddlLotAttribute07.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute08
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute08.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute08.Text.Trim(), this.ddlLotAttribute08.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute09
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute09.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute09.Text.Trim(), this.ddlLotAttribute09.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute10
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute10.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute10.Text.Trim(), this.ddlLotAttribute10.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string ProduceDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtProduceDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtProduceDate.Text, this.ddlProduceDateOper.SelectedValue, this.txtProduceDate.Text.Trim(), "ProduceDate");
                }
                return "";
            }
        }

        public string ShoLot
        {
            get
            {
                if (this.ckbShowLot.Checked)
                {
                    return "Y";
                }
                return "N";
            }
        }

        public string SkuClassID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuClassID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuClassID.Text.Trim(), this.ddlSkuClassID.SelectedValue);
                }
                return "";
            }
        }

        public string SkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuID.Text.Trim(), this.ddlSkuID.SelectedValue);
                }
                return "";
            }
        }

        public string StartTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtStartTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtStartTime.Text.Trim()).ToString("yyyy-MM-dd") + " 00:00:00");
                }
                return "2000-01-01 00:00:00";
            }
        }

        public string VendorID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVendorID.Text.Trim(), this.ddlVendorID.SelectedValue);
                }
                return "";
            }
        }
    }
}

